using SQLite;

namespace SideEffectDemo;

public class PoetryService : IPoetryService {
    public static readonly string DBPath = Path.Combine(
        Environment.GetFolderPath(
            Environment.SpecialFolder.LocalApplicationData),
        "db.sqlite3");

    private SQLiteAsyncConnection _connection;

    private SQLiteAsyncConnection Connection =>
        _connection ??= new SQLiteAsyncConnection(DBPath);

    public async Task InitializeAsync() {
        await Connection.CreateTableAsync<Poetry>();
    }
}